﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DCSLibrary;
using Utils.DatabaseUtils;

public partial class Admin_Module_quan_tri_thong_tin_ho_tro_khach_hang : System.Web.UI.UserControl
{
    SupportUI obj = new SupportUI();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadEditData();
        }
    }

    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int result = obj.Update(1, 1, txtYahoo1.Text.Trim(), txtYahoo2.Text.Trim(), txtEmail.Text.Trim(), txtYahoo3.Text.Trim(), txtFacebook.Text.Trim(),1);
        if (result > 0)
        {
            lblMessage.Text = "Cập nhật thông tin thành công";
        }
        else
        {
            lblMessage.Text = "Cập nhật thông tin thất bại";
        }
    }

    protected void LoadEditData()
    {
        DataSet ds = obj.Get(1);
        if (TableLib.HasData(ds))
        {
            DataRow row = ds.Tables[0].Rows[0];
            txtEmail.Text = row["Tel"].ToString();
            txtYahoo1.Text = row["Location"].ToString();
            txtYahoo2.Text = row["Supporter"].ToString();
            txtYahoo3.Text = row["YM"].ToString();
            txtFacebook.Text = row["Sky"].ToString();
        }
    }
}
